﻿<navigation:Page x:Class="Slex.Lib.Demo.Views.Demos.PropertyTrigger" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"      
           xmlns:slex="clr-namespace:Slex.Lib.Interactions;assembly=Slex.Lib"      
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="EventTrigger Page">
    <Grid x:Name="LayoutRoot">
        <i:Interaction.Triggers>
            <slex:PropertyTrigger ElementName="txtData" Property="Text">
                <slex:InvokeCommandAction CommandName="UpdateDataCommand">
                    <slex:InvokeCommandAction.Conditions>
                    <slex:InvokingConditions>
                        <slex:InvokingCondition Value="Hello"/>
                        <slex:InvokingCondition ElementName="myCheckBox" Property="IsChecked" Value="True"/>
                    </slex:InvokingConditions>
                  </slex:InvokeCommandAction.Conditions>
                </slex:InvokeCommandAction>
            </slex:PropertyTrigger>
        </i:Interaction.Triggers>
        <StackPanel>
            <TextBlock FontSize="20" Text="Property Trigger Demo"/>
            <TextBlock Margin="4" TextWrapping="Wrap" 
                       Text="This demo shows how to invoke an action when a property is changed, based on multiple conditions. Type 'Hello' in the below text box, with the check box checked, to fire the command"/>
            <TextBox Margin="4" Name="txtData" Text="Type Hello here, with the checkbox checked"/>
            <StackPanel Background="LightGray" Margin="5">
                <TextBlock Margin="4" Text="{Binding Data}" FontSize="14"/>
                <CheckBox Name="myCheckBox" Content="Check to Fire The Command if 'Hello' is entered"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</navigation:Page>
